package com.hyphenate.helpdesk.easeui.util;

import android.content.Context;
import android.content.SharedPreferences;

public class Preferences {

    static private Preferences instance = null;
    static private String PREFERENCE_NAME = "message_customer_service";
    static private String KEY_APPKEY = "message_count";

    private SharedPreferences pref = null;
    private SharedPreferences.Editor editor = null;

    static public Preferences getInstance() {
        return instance;
    }

    public static void init(Context context) {
        instance = new Preferences();
        instance.pref = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
        instance.editor = instance.pref.edit();
    }

    public synchronized void setMessageSize(int key) {
        editor.putInt(KEY_APPKEY, key);
        editor.commit();

    }

    public synchronized int getMessageSize() {
        return pref.getInt(KEY_APPKEY, 0);
    }

    public synchronized void clearMessageSize() {
        setMessageSize(0);
    }


}
